package edu.sctu.zhengsenwen.month201505.day20150512;

/**
* Created by user15 on 2015/5/13.
*/
public class TextChildTwo extends ForExtends {

    public TextChildTwo(Students[] a) {
        super(a);
    }

    @Override
    public Students[] getSysTem() {

        int j=0;
        for(int i=0;i<a.length;i++){

            if((a[i].getSex() == "男") && (a[i].getGrade() > 60)){

                j++;
                System.out.println("姓名："+a[i].getName()+"\t"
                        +"性别："+a[i].getSex()+"\t"+"成绩："+a[i].getGrade()+"\t"+"年龄："+a[i].getAge()+"\t"
                        +"学号："+a[i].getStudentID()+"\t"+"地址："+a[i].getAddress());
            }
        }

        System.out.println("成绩在60分以上的男生人数："+j);

        return a;
    }


    MyInterface interfaceone = new MyInterface() {
        @Override
        public int judgeAge(int age) {
            return age;
        }
    };


    public void WayTwo(MyInterface interfaceone){

        int age2;

        age2  = interfaceone.judgeAge(20);

        int k=0;
        for(int i=0;i<a.length;i++) {

            if (a[i].getAge()>age2) {

                System.out.println("姓名："+a[i].getName()+"\t"+"年龄："+a[i].getAge()+"\t" +"成绩："+a[i].getGrade()+ "\t"
                        +"性别："+a[i].getSex()+"\t" +"学号："+a[i].getStudentID()+"\t" +"地址："+a[i].getAddress());

                k++;
            }
        }

        System.out.println("年龄大20岁的学生人数："+k);
    }
}

